package net.sudot.chess.plugin;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 插件属性
 *
 * @author tangjialin on 2018-03-18.
 */
@Getter
@Setter
@Accessors(chain = true)
public class PluginAttributeConfig implements Serializable {
    /** 属性编码 */
    private String code;
    /** 属性中文名 */
    private String name;
    /** 是否必须输入项 */
    private boolean required;
    /** 验证规则:正则表达式 */
    private String validateRule;

    public PluginAttributeConfig() {
    }

    public PluginAttributeConfig(String code, String name) {
        this.code = code;
        this.name = name;
        this.required = false;
    }

    public PluginAttributeConfig(String code, String name, boolean required) {
        this.code = code;
        this.name = name;
        this.required = required;
    }

    public PluginAttributeConfig(String code, String name, String validateRule) {
        this.code = code;
        this.name = name;
        this.required = true;
        this.validateRule = validateRule;
    }

    public PluginAttributeConfig(String code, String name, boolean required, String validateRule) {
        this.code = code;
        this.name = name;
        this.required = required;
        this.validateRule = validateRule;
    }

}